package com.xxl.job.executor.model;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * @author: liu.ziyang
 * @date: 2021/3/29 11:09
 * @description: java类作用描述
 */
public class JsonBkInterfaceModel<T> {

    private JsonHeaderModel header;
    private T body;

    public JsonHeaderModel getHeader() {
        return header;
    }

    public void setHeader(JsonHeaderModel header) {
        this.header = header;
    }

    public T getBody() {
        return body;
    }

    public void setBody(T body) {
        this.body = body;
    }

    @Override
    public String toString() {
        return "JsonQhyInterfaceModel{" +
                "header=" + header +
                ", body=" + body +
                '}';
    }

    public String toJson(){
        String headerJson = JSONObject.fromObject(header).toString();
        String dataJson = JSONObject.fromObject(body).toString();
        return "{" +
                "\"header\"" + ":" + headerJson + "," +
                "\"body\"" + ":" +
                 dataJson +

                "}";
    }
}
